//
//  YJDNewsViewController.m
//  YJDSDK
//
//  Created by skyline on 2018/3/9.
//  Copyright © 2018年 skyline. All rights reserved.
//

#import "YJDNewsViewController.h"
#import "YJDNewsCell.h"
@interface YJDNewsViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *newsList;
@end

@implementation YJDNewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.newsList.hidden = NO;
    self.naviBar.title = @"我的消息";
    // Do any additional setup after loading the view.
}

- (UITableView *)newsList
{
    if (!_newsList)
    {
        _newsList = [[UITableView alloc] init];
        _newsList.separatorStyle = UITableViewCellSeparatorStyleNone;
        _newsList.dataSource = self;
        _newsList.delegate = self;
        _newsList.bounces = NO;
        [self.view addSubview:_newsList];
        [_newsList mas_makeConstraints:^(SK_MASConstraintMaker *make) {
            make.top.equalTo(self.naviBar.mas_bottom);
            make.left.equalTo(self.view);
            make.right.equalTo(self.view);
            make.bottom.equalTo(self.view);
        }];
    }
    return _newsList;
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *idenfier = @"YJDNewsCell";
    YJDNewsCell *cell = [tableView dequeueReusableCellWithIdentifier:idenfier];
    if (!cell)
    {
        cell = [[YJDNewsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:idenfier];
    }
    cell.dict = @{@"imageName":@"portrait",
                  @"title":@"欢迎加入海跃游戏大家庭",
                  @"content":@"海跃游戏用户中心祝您游戏愉快",
                  @"time":@"2018-02-10"};
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return NEWSCELLHEIGHT;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.naviBar.hidden = NO;
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
